package com.ycrlkj.android.modulescore.main.entity.validate;

import android.text.TextUtils;
import com.ycrlkj.android.modulesbase.libbase.utils.PhoneUtil;
import com.ycrlkj.android.modulescore.main.entity.User;

public class UserValidate {

    public static String validateForm(User form){

        String phone = form.getPhone();
        if(TextUtils.isEmpty(phone)){
            return "手机号必须填写";
        }

        if(!PhoneUtil.isMobileNumberEasy(phone)){
            return "请填写正确的手机号";
        }

        String password = form.getPassword();
        if(TextUtils.isEmpty(password)){
            return "密码必须填写";
        }

        if(password.length() < 6){
            return "密码至少6位";
        }

        return null;
    }

}
